<?php

class jqueryWidget extends CWidget {

    public $version = '1.8.3';
    public function run() {
	  // External load of jquery if we are not on the local network (ie through proxy)
	  $jqueryUrl = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? 'http://ajax.googleapis.com/ajax/libs/jquery/'.$this->version.'/jquery.min.js' : Yii::app()->request->baseUrl . '/js/libs/jquery-'.$this->version.'.min.js';
	  Yii::app()->clientScript->registerScriptFile($jqueryUrl, CClientScript::POS_HEAD);
	  Yii::app()->clientScript->scriptMap = array(
		'jquery.js' => $jqueryUrl,
	  );
    }

}